package com.example.websocketdemo.controller;

import com.alibaba.fastjson.JSONObject;
import com.example.websocketdemo.config.WebSocketTest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("/MajorSourceOfDanger")
public class MajorSourceOfDangerController {

    @GetMapping("/monitoring")
    public void monitoring() throws IOException {
        JSONObject jsonObject_one = new JSONObject();
        jsonObject_one.put("instruction","resetpoi");
        WebSocketTest.sendInfo(jsonObject_one.toJSONString(), "connect");
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("MenuName","MajorSourceOfDanger");
        jsonObject.put("ButtonName","monitoring");
        WebSocketTest.sendInfo(jsonObject.toJSONString(), "connect");
    }

    @GetMapping("/emergencySupplies")
    public void emergencySupplies() throws IOException {
        JSONObject jsonObject_one = new JSONObject();
        jsonObject_one.put("instruction","resetpoi");
        WebSocketTest.sendInfo(jsonObject_one.toJSONString(), "connect");
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("MenuName","MajorSourceOfDanger");
        jsonObject.put("ButtonName","emergencySupplies");
        WebSocketTest.sendInfo(jsonObject.toJSONString(), "connect");
    }

}
